<!DOCTYPE html>
<html>

	<head lang="en">
		<meta charset="UTF-8">
		<title>注册</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<meta name="format-detection" content="telephone=no">
		<meta name="renderer" content="webkit">
		<meta http-equiv="Cache-Control" content="no-siteapp" />

		<link rel="stylesheet" href="./AmazeUI-2.4.2/assets/css/amazeui.min.css" />
		<link href="./css/dlstyle.css" rel="stylesheet" type="text/css">
		<script src="./AmazeUI-2.4.2/assets/js/jquery.min.js"></script>
		<script src="./AmazeUI-2.4.2/assets/js/amazeui.min.js"></script>
	</head>

	<body>

		<div class="login-boxtitle">
			<a href="home/demo.html"><img alt="" src="./images/logobig.png" /></a>
		</div>

		<div class="res-banner">
			<div class="res-main">
				<div class="login-banner-bg"><span></span><img src="./images/big.jpg" /></div>
					<div id="registerDiv" class="login-box">
						<div class="am-tabs" id="doc-my-tabs">
							<ul class="am-tabs-nav am-nav am-nav-tabs am-nav-justify">
								<li class="am-active"><a href="">邮箱注册</a></li>
								<li><a href="">手机号注册</a></li>
							</ul>
						<div class="am-tabs-bd">
					<div class="am-tab-panel am-active">

			<form method="post" v-model="userEmailForm">
			   	<div class="user-email">
									<label for="email"><i class="am-icon-envelope-o"></i></label>
									<input type="email" v-model="userEmailForm.email"  id="email" placeholder="请输入邮箱账号">
			 	</div>
				<div class="verification">
									<label for="code"><i class="am-icon-code-fork"></i></label>
									<input type="text" v-model="userEmailForm.code" id="code" placeholder="请输入验证码">
									<button id="EmailMobileCode" type='button' v-on:click="emailMobileCode">获取</button>e
				</div>
                 <div class="user-pass">
								    <label for="password"><i class="am-icon-lock"></i></label>
								    <input type="password" v-model="userEmailForm.password" id="password" placeholder="设置密码">
                 </div>										
                 <div class="user-pass">
								    <label for="passwordRepeat"><i class="am-icon-lock"></i></label>
								    <input type="password" v-model="userEmailForm.passwordRepeat" id="passwordRepeat" placeholder="确认密码">
                 </div>
			</form>

								 <div class="login-links">
										<label for="reader-me">
											<input id="reader-me" type="checkbox"> 点击表示您同意商城《服务协议》
										</label>
							  	</div>
								<div class="am-cf">
										<input type="submit" value="注册" v-on:click="EmailRegister"  class="am-btn am-btn-primary am-btn-sm am-fl">
								</div>
		</div>

		<div class="am-tab-panel">

			<form method="post" v-model="userPhoneForm">
                 <div class="user-phone">
								    <label for="phone"><i class="am-icon-mobile-phone am-icon-md"></i></label>
								    <input type="tel"  v-model="userPhoneForm.phone" name="" id="phone" placeholder="请输入手机号">
                 </div>																			
										<div class="verification">
											<label for="code"><i class="am-icon-code-fork"></i></label>
											<input type="text" v-model="userPhoneForm.code"name="" id="code" placeholder="请输入验证码">
											<button id="PhoneMobileCode" type='button' v-on:click="phoneMobileCode">获取</button>
										</div>
                 <div class="user-pass">
								    <label for="password"><i class="am-icon-lock"></i></label>
								    <input type="password" v-model="userPhoneForm.password" name="" id="password" placeholder="设置密码">
                 </div>										
                 <div class="user-pass">
								    <label for="passwordRepeat"><i class="am-icon-lock"></i></label>
								    <input type="password" v-model="userPhoneForm.passwordRepeat" name="" id="passwordRepeat" placeholder="确认密码">
                 </div>
			</form>
									 <div class="login-links">
									<label for="reader-me">
										<input id="reader-me" type="checkbox"> 点击表示您同意商城《服务协议》
									</label>
									</div>
									<div class="am-cf">
										<input type="submit"  value="注册"  class="am-btn am-btn-primary am-btn-sm am-fl">
									</div>
		</div>

								<script>
									$(function() {
									    $('#doc-my-tabs').tabs();
									  })
								</script>

							</div>
						</div>

				</div>
				<!--引入vue和axios-->
				<script src="./plugins/vue/dist/vue.min.js"></script>
				<script src="./plugins/axios/dist/axios.js"></script>
				<!--<script>-->
				<!--//给vue添加一个全局属性-->
				<!--Vue.prototype.$http=axios;-->
				<!--//配置axios的全局基本路径-->
				<!--axios.defaults.baseURL='http://localhost:80/'-->
				<!--</script>-->
				<script src="./js/common.js"></script>
				<!--vue的js写法-->
				<script type="text/javascript">
                    //创建vue是需要给他传递一个对象
                    new Vue({
                        el:"#registerDiv", //id在hmtl模板中要对应
                        data:{ //数据模型
                            userPhoneForm:{
                                phone:'',
								code:'',
								password:'',
                                passwordRepeat:''
							},
							userEmailForm:{
								email:'',
								code:'',
								password:'',
								passwordRepeat:''
							},
                        },
                        methods:{//方法
							/**获取邮箱验证码*/
							emailMobileCode(e){//获取邮箱验证码
								let email = this.userEmailForm.email;
								//1 校验phone
								if(email==null){
									alert("请输入邮箱！");
									return;
								}
								//2 灰化按钮
								$(event.target).attr("disabled",true);
								//倒计时处理
								let time = 60;
								var timer = window.setInterval(function () {
									time--;
									$("#EmailMobileCode").html(time);
									if(time<=0){
										window.clearInterval(timer);
										$("#EmailMobileCode").attr("disabled",false);
										$("#EmailMobileCode").html("重发");
									}
								},1000);
								//3 发送请求，根据请求做事
								this.$http.post("/USER/Verification_code/email",{"email":email})
										.then(result=>{
											if(result.data.success){
												alert("验证码已经发送到您的邮箱，请在5分钟内使用");
											}else{
												alert(result.data.message)
												//3.2 如果失败解除灰化
												$("#EmailMobileCode").attr("disabled",false);
												$("#EmailMobileCode").html("重发");
											}
										})
							},
							/**获取手机验证码*/
							phoneMobileCode(e){
								let phone = this.userPhoneForm.phone;
								//1 校验phone
								if(phone==null){
									alert("请输入手机号码！");
									return;
								}
								//2 灰化按钮
								$(event.target).attr("disabled",true);
								//3 发送请求，根据请求做事
								this.$http.post("/USER/Verification_code/phone",{"phone":phone})
										.then(result=>{
											//3.1 倒计时处理
											if(result.data.success){
												let time = 60;
												var timer = window.setInterval(function () {
													time--;
													$("#PhonesendMobileCode").html(time);
													if(time<=0){
														window.clearInterval(timer);
														$("#PhonesendMobileCode").attr("disabled",false);
														$("#PhonesendMobileCode").html("重发");
													}
												},1000)
												alert("手机验证码已经发送到您的手机，请在5分钟内使用");
											}else{
												alert(result.data.message)
												//3.2 如果失败解除灰化
												$("#PhonesendMobileCode").attr("disabled",false);
												$("#PhonesendMobileCode").html("重发");
											}
										})
							},
							EmailRegister(e){
								let para = this.userEmailForm;
									/**校验*/
									if (!para.email){
										alert("请输入邮箱");
										return
									};
									if (!para.code){
										alert("请输入验证码");
										return
									};
									if (!para.password){
										alert("请输入密码");
										return
									};
									if (!(para.passwordRepeat===para.password)){
										alert("确认密码不一致");
										return
									};
								this.$http.post("/USER/register/email",para)
										.then(result=>{
											if(result.data.success){
												alert("注册成功");
												location.href = "/login.html"
											}else{
												alert("注册失败  ："+result.data.message)
											}
										});
							},
                        }
                    })
				</script>
			</div>
			
					<div class="footer ">
						<div class="footer-hd ">
							<p>
								<a href="# ">恒望科技</a>
								<b>|</b>
								<a href="# ">商城首页</a>
								<b>|</b>
								<a href="# ">支付宝</a>
								<b>|</b>
								<a href="# ">物流</a>
							</p>
						</div>
						<div class="footer-bd ">
							<p>
								<a href="# ">关于恒望</a>
								<a href="# ">合作伙伴</a>
								<a href="# ">联系我们</a>
								<a href="# ">网站地图</a>
								<em>© 2015-2025 Hengwang.com 版权所有. 更多模板 <a href="http://www.cssmoban.com/" target="_blank" title="模板之家">模板之家</a> - Collect from <a href="http://www.cssmoban.com/" title="网页模板" target="_blank">网页模板</a></em>
							</p>
						</div>
					</div>

	</body>

</html>